<?php
namespace app\home\model;
use think\Model;

class Banner extends Model
{
    protected $table = 'stpc_banner';
    protected $pk = 'id';
    
    // 设置字段信息
    protected $schema = [
        'id'                => 'int',
        'img_url'           => 'string',
        'redirect_url'      => 'string',
        'order'             => 'int',
    ];

    public static function getAll(){
        $res = self::field(['redirect_url', 'img_url'])
                    ->order('order')
                    ->select();
        if (empty($res)) {
            $res = array(array('title' => '真木网', 'url' => '', 'thumbnail' => 'http://zhenmuwang.oss-cn-beijing.aliyuncs.com/zmw_banner_81578c17dc8d3caca3d8baf821ab0b17.png'));
        }
        return $res;
    }
}